package com.huawei.appgallery.assistantdock.base.externalaction.openviewaction;

import android.text.TextUtils;
import com.huawei.secure.android.common.intent.SafeIntent;
import java.util.HashMap;
import java.util.Map;
import o.Logger;
import o.dys.a;

public class OpenViewActionRegistry {
    private static Map<String, Class<? extends IOpenViewAction>> ACTIVITY_MAPS = new HashMap();
    private static final String TAG = "OpenViewActionRegistry";

    public static void register(String str, Class<? extends IOpenViewAction> cls) {
        ACTIVITY_MAPS.put(str, cls);
    }

    public static void unregister(String str) {
        ACTIVITY_MAPS.remove(str);
    }

    public static IOpenViewAction getAction(a aVar, String str, SafeIntent safeIntent) {
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        Class cls = (Class) ACTIVITY_MAPS.get(str);
        if (cls == null) {
            return null;
        }
        try {
            return (IOpenViewAction) cls.getConstructor(new Class[]{a.class, SafeIntent.class}).newInstance(new Object[]{aVar, safeIntent});
        } catch (Throwable e) {
            Logger.ˋ(TAG, "init Action failed!", e);
            return null;
        } catch (Throwable e2) {
            Logger.ˋ(TAG, "init Action failed!", e2);
            return null;
        } catch (Throwable e22) {
            Logger.ˋ(TAG, "init Action failed!", e22);
            return null;
        } catch (Throwable e222) {
            Logger.ˋ(TAG, "init Action failed!", e222);
            return null;
        } catch (Throwable e2222) {
            Logger.ˋ(TAG, "init Action failed!", e2222);
            return null;
        }
    }
}
